#ifndef NET_PAN
#define NET_PAN
#include <func.h>
#include "task_queue.h"
//最长路径假定不超过1024
enum args_type{
ID_PASSWORD,CD,LS,PUTS,GETS,REMOVE,PWD,MKDIR,RMDIR,EXIT
};
typedef struct{
    int length;
    char data[1000];
}train_t;
typedef struct net_pan_s {
    pthread_t *tidArr;
    int threadnum;
    taskQueue_t taskQueue;
    int exitFlag; // 不退出写0 退出写1
}net_pan_t;
//用户ID 操作 路径 成功或失败 时间 

#define SYSLOG(id,op,path,flag) {                                               \
    time_t now;                                                                 \
    time(&now);                                                                 \
    struct tm* ptime=gmtime(&now);                                              \
    syslog(LOG_INFO,"ID %s,operate %s,path %s %s %04d:%02d:%02d",id,op,path,    \
           flag,(1900+ptime->tm_year),(1+ptime->tm_mon),(ptime->tm_mday));      \
}                                                                               \

int work(int netfd,struct sockaddr_in* netaddr);
int net_pan_init(net_pan_t *net_pan,int workernum);
int makeWorker(net_pan_t *net_pan);
int tcpInit(const char *ip, const char *port, int *psockfd);
int epollAdd(int epfd, int fd);
int epollDel(int epfd, int fd);
int args_get(char *path,char* ip,char* prot,char* num);
#endif
